﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StaffingSystem.EF;
using System.Data.SqlClient;

namespace StaffingSystem.Business
{
    public class EmployeeCompile
    {
        Management management = new Management();
        public int UpdateCompile(personnelinfor person)
        {
            try
            {
                StringBuilder procString = new StringBuilder();
                procString.Append("UpdatePersonnelInfor_proc");
                procString.Append(" @Id,");
                procString.Append("@Name,");
                procString.Append("@Sex,");
                procString.Append("@Age,");
                procString.Append("@Nation,");
                procString.Append("@Education,");
                procString.Append("@IDNumber,");
                procString.Append("@Phone,");
                procString.Append("@Address,");
                procString.Append("@AddTime");

                SqlParameter[] parameter = new SqlParameter[]
                {
                    new SqlParameter("@Id",person.Id),
                     new SqlParameter("@Name",person.Name),
                      new SqlParameter("@Sex",person.Sex),
                       new SqlParameter("@Age",person.Age),
                        new SqlParameter("@Nation",person.Nation),
                        new SqlParameter("@Education",person.Education),
                         new SqlParameter("@IDNumber",person.IDNumber),
                         new SqlParameter("@Phone",person.Phone),
                         new SqlParameter("@Address",person.Address),
                         new SqlParameter("@AddTime",person.AddTime)

                };
                int a = management.Database.ExecuteSqlCommand(procString.ToString(), parameter);
                return a;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

    }
}
